<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>throttle</title>
    <style>
      .container {
        width: 100%;
        height: 200px;
        line-height: 200px;
        text-align: center;
        color: #fff;
        background-color: #444;
        font-size: 30px;
      }
    </style>
  </head>
  <body>
    <h3>throttle</h3>
    <div class="container" id="throttleDom"></div>
    <br />
    <br />
    <br />
    <h3>debounce</h3>
    <div class="container" id="debounceDom"></div>
    <script src="./index.js"></script>
    <script>
      var throttleCount = 1
      var throttleDom = document.getElementById('throttleDom')
      function throttleDomCount() {
        throttleDom.innerHTML = throttleCount++
      }
      throttleDom.onmousemove = debounce(throttleDomCount, 1000, false, true)

      var debounceCount = 1
      var debounceDom = document.getElementById('debounceDom')
      function debounceDomCount() {
        debounceDom.innerHTML = debounceCount++
      }
      debounceDom.onmousemove = debounce(debounceDomCount, 300, true)
    </script>
  </body>
</html>
